package com.lry.pda.bottom.c.backend;

import com.lry.pda.bottom.c.backend.type.Declarator;
import com.lry.pda.bottom.c.backend.type.Symbol;

public class ArrayValueSetter implements IValueSetter{

    private Symbol symbol;
    private int index = 0;

    public ArrayValueSetter(Symbol symbol, int index) {
        this.symbol = symbol;
        this.index = index;
    }

    @Override
    public void setValue(Object obj)   {

        Declarator declarator = symbol.getDeclarator(Declarator.ARRAY);

        declarator.setElement(index,obj);
        System.out.println("Set Value of " + obj.toString() + " to Array of name " + symbol.getName() + " with index of " + index);
    }
}
